package com.lx.regex;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.logging.SimpleFormatter;

public class addmonthdemo {
    public static void main(String[] args) throws ParseException {
//        methon01();
//        second秒钟，milli毫秒，nanoAdjustment纳秒
//        method2();
        method3();
    }

    private static void method3() {
        ZonedDateTime time = Instant.now().atZone(ZoneId.of("Africa/Nairobi"));
        DateTimeFormatter dtf =  DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss EE a");
        System.out.println(dtf.format(time));
    }

    private static void method2() {
        Instant instant1 = Instant.ofEpochMilli(0L);
        Instant instant2 = Instant.ofEpochSecond(1L);
        System.out.println("-----------------------");
        System.out.println(instant1);
        System.out.println("-----------------------");
        System.out.println(instant2);
        System.out.println("-----------------------");
        Instant instant3 = Instant.ofEpochSecond(1L,10000000000L);
        System.out.println(instant3);
    }

    private static void methon01() throws ParseException {
        String str  = "2003年9月10日";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
        Date date = sdf.parse(str);
        String str2 = sdf.format(date);
//        System.out.println(date);
        System.out.println(str2);
        date.setTime(date.getTime()+(1000L *60*60*24*30));
        System.out.println(sdf.format(date));
    }

}
